﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Edit.ascx.vb" Inherits="Control_CertifiedHousehold_Edit" %>
<%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
<%@ Register Assembly="ValidationTextBox" Namespace="ValidationTextBox.CustomControls"
    TagPrefix="cc1" %>
<%@ Register Assembly="ValidationDropdownlist" Namespace="ValidationDropdownlist.CustomControls"
    TagPrefix="cc2" %>
<script type="text/javascript">
    function ktraCMND() {
        var check = 1;
        if ($("#<%= txtOwCardId.ClientID %>").val() == '') {
            $("#<%= txtOwCardId.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= txtOwCardId.ClientID %>").removeClass("mandatory");

        }

        if ($("#<%= txtOwCardDate.ClientID %>").val() == '') {
            $("#<%= txtOwCardDate.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= txtOwCardDate.ClientID %>").removeClass("mandatory");

        }

        if ($("#<%= ddlDeptCertified.ClientID %>").val() == '') {
            $("#<%= ddlDeptCertified.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= ddlDeptCertified.ClientID %>").removeClass("mandatory");

        }
        return check;
    }

    function ktraGTK() {
        var check = 1;
        if ($("#<%= ddlOthersPaper.ClientID %>").val() == '') {
            $("#<%= ddlOthersPaper.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= ddlOthersPaper.ClientID %>").removeClass("mandatory");
        }
        if ($("#<%= txtOtherPaperCode.ClientID %>").val() == '') {
            $("#<%= txtOtherPaperCode.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= txtOtherPaperCode.ClientID %>").removeClass("mandatory");
        }
        if ($("#<%= txtOthersPaperDateIssue.ClientID %>").val() == '') {
            $("#<%= txtOthersPaperDateIssue.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= txtOthersPaperDateIssue.ClientID %>").removeClass("mandatory");
        }
        if ($("#<%= ddlOthersPaper_NoiCap.ClientID %>").val() == '') {
            $("#<%= ddlOthersPaper_NoiCap.ClientID %>").addClass("mandatory");
            check = 0;
        }
        else {
            $("#<%= ddlOthersPaper_NoiCap.ClientID %>").removeClass("mandatory");
        }
        return check;
    }
    $(function () {

        var _gtk = $('#gtk')
        var _cmnd = $('#cmnd')
        //click vào link cmnd hidden div#gtk - show div#cmnd
        $('.cmnd').click(function () {
            _gtk.hide(1500);
            _cmnd.show(1500);

            //add class active cho link được click
            $('.gtk').removeClass('active');
            $(this).addClass("active")
            return false;
        });

        //click vào link gtk show div#gtk - hidden div#cmnd
        $('.gtk').click(function () {
            _cmnd.hide(1500);
            _gtk.show(1500);

            //add class active cho link được click
            $('.cmnd').removeClass('active');
            $(this).addClass("active")
            return false;
        });
        $("#<%= btnSave.ClientID %>").click(function () {
            var check = 0;
            if ($("#cmndRegion").hasClass("active")) {
                check = ktraCMND();
            }
            else {
                check = ktraGTK();
            };

            if ((validateFormInputs('reg') == true) && (check == 1)) {
                return true;

            } else {
                return false;
            }

        });
        $(".Date").datepicker({ dateFormat: 'dd/mm/yy' });
        $("#<%=txtBiz_InvestCapital.ClientId %>").keyup(function () {
            var abc = docso($(this).val());
            $("#<%=txtBiz_WordsMoney.ClientId %>").html(abc);
            $("#<%=txtMoney_string.ClientId %>").val($("#<%=txtBiz_WordsMoney.ClientId %>").html());
        });
        //Tỉnh hộ khẩu thường trú
        $("#<%= ddlTinhHoKhau.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlHuyenHoKhau.ClientID %>"));
        });
        //Huyện hộ khẩu thường trú
        $("#<%= ddlHuyenHoKhau.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlXaThiTranHoKhau.ClientID %>"));
            $("#<%= hidHuyenHoKhau.ClientID %>").val($(this).val());
        });
        //Xa thị trấn hộ khẩu thường trú
        $("#<%= ddlXaThiTranHoKhau.ClientID %>").change(function () {
            $("#<%= hidXaThiTranHoKhau.ClientID %>").val($(this).val());
        });

        //Tỉnh tạm trú
        $("#<%= ddlTinhHienTai.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlHuyenHienTai.ClientID %>"));
        });
        //Huyện tạm trú
        $("#<%= ddlHuyenHienTai.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlXaThiTranHienTai.ClientID %>"));
            $("#<%= hidHuyenHienTai.ClientID %>").val($(this).val());
        });
        //Xa thị trấn hộ khẩu thường trú
        $("#<%= ddlXaThiTranHienTai.ClientID %>").change(function () {
            $("#<%= hidXaThiTranHienTai.ClientID %>").val($(this).val());
        });

        //Tỉnh địa điểm kinh doanh
        $("#<%= ddlTinhDiaDiemKD.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlHuyenDiaDiemKD.ClientID %>"));
        });
        //Huyện địa điểm kinh doanh
        $("#<%= ddlHuyenDiaDiemKD.ClientID %>").change(function () {
            getProvince($(this).val(), $("#<%= ddlXaThiTranDiaDiemKD.ClientID %>"));
            $("#<%= hidHuyenDiaDiemKD.ClientID %>").val($(this).val());
        });
        //Xa thị trấn hộ khẩu thường trú
        $("#<%= ddlXaThiTranDiaDiemKD.ClientID %>").change(function () {
            $("#<%= hidXaThiTranDiaDiemKD.ClientID %>").val($(this).val());
        });

        // Get Detail Orderss
        var surl = '<%=ResolveUrl("~/Page/CertifiedHousehold.ashx")%>';
        var hidId = $("#<%= hidID.ClientID %>").val();
        surl += "?CertifiedID=" + hidId;
        $.ajax({
            url: surl,
            dataType: "json",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataFilter: function (data) {
                return data;
            },
            success: function (data) {
                if (data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe != null) {
                    if (data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe.length != null) {

                        //Chi tiet don hang co nhieu hon 1 item
                        if (data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe.length > 0) {
                            for (i = 0; i < data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe.length; i++) {
                                $("#tableChoices").append(RowDetailOrder(i, data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe[i]));
                                //nghiavt sau khi return str --> settype for nubmer va
                                SetTypeforNumber(i);
                                // ListenEnterOnForm();
                            }
                            $("#<%= hidRowIndex.ClientId %>").val(data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe.length);
                        }
                    }
                    else {
                        //Chi tiet don hang co 1 item           
                        var ctrlId = 0;
                        $("#tableChoices").append(RowDetailOrder(0, data.CertifiedHouseholdNganhNghes.CertifiedHouseholdNganhNghe));
                        SetTypeforNumber(ctrlId);
                        $("#<%= hidRowIndex.ClientId %>").val(1);
                    }
                    SetAutoComplete();
                    ListenEnterOnForm();
                }
                else {
                    $("#<%=hidSale_Unit.ClientId %>").val(2);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                Alertbox("Error")
            }
            //LANG NGHE ENTER
            //  ListenEnterOnForm();
        });
    });


    function showRowIndexs() {
        var i = 0;
        $("#tableChoices tr td.tdLabel").each(function () {
            i++;
            $(this).html(i + ".");
        });

    }

    // Thêm 1 dòng sản phẩm mới để nhập
    function addFormField() {
        var ctrlId = $("#<%= hidRowIndex.ClientID %>").val();
        $("#tableChoices").append("<tr id='pRow" + ctrlId + "'><td width='20px' class='tdLabel'>" + (ctrlId * 10) + ".</td><td width='130px'><textarea rows='3' cols='10' class='TextBox' type='text' name='txtDescription" + ctrlId + "' id='txtDescription" + ctrlId + "' /></td><td width='130px'><input  class='TextBoxInPut' type='text' name='txtChoice" + ctrlId + "' id='txtChoice" + ctrlId + "' style = 'width: 130px' onblur='SetOnBlurMaterial(" + ctrlId + ")' /></td><td><span id = 'spName" + ctrlId + "'></span></td><td nowrap ='nowrap' align = 'center'>&nbsp;&nbsp;<a id = 'hplSel" + ctrlId + "'  href = 'javascript:SelectCentifiedHouseholdNganhNghe(" + ctrlId + ")'>Chọn</a>&nbsp;-&nbsp;<a href='#' onClick='removeFormField(\"#pRow" + ctrlId + "\"); return false;'>Xóa</a><input type='text' name='hidAmount" + ctrlId + "' id='hidAmount" + ctrlId + "' value = '0' style = 'width: 1px; display: none' /></td></tr>");
        // CreateOption(ctrlId);
        // SetTypeforNumber(ctrlId);
        $("#<%= hidRowIndex.ClientID %>").val(++ctrlId);

        showRowIndexs();

        SetAutoComplete();

        $("#<%= divChoices.ClientID %> #tableChoices input").focus(function () {
            $("#curId").val(this.id);
        });
    }

    // Xet chi cho go cac phim so tren ban phim
    function SetTypeforNumber(sIndex) {
        $("#txtAmount" + sIndex).keydown(function (event) {
            // Allow: backspace, delete, tab and escape
            if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 ||
            // Allow: Ctrl+A
            (event.keyCode == 65 && event.ctrlKey === true) ||
            // Allow: home, end, left, right
            (event.keyCode >= 35 && event.keyCode <= 39)) {
                // let it happen, don't do anything
                return;
            }
            else {
                // Ensure that it is a number and stop the keypress
                if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {
                    event.preventDefault();
                }
            }
        });
    }

    function removeFormField(id) {

        var indexRow = eval(id.substring(5, id.length));
        var cId = $("input:hidden", id).val();
        var data = "{'cID':'" + cId + "'}"; //create the JSON data to send to server
        if (cId > 0) //call the Page method using JQuery ajax 
        {
            $.ajax(
            {
                type: "POST",
                url: "Edit.aspx/DeletePollChoice",
                data: data,
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            });
        }
        $(id).remove();
        var index = $("#<%=hidRowIndex.ClientId %>");

        // Nếu dòng chọn xóa  nằm trc dòng cuối cùng
        if (indexRow + 1 < index.val()) {
            for (i = indexRow + 1; i < index.val(); i++) {
                // Lấy index dòng mới
                var ctrlId = i - 1;
                // Nếu là dòng đã có dự liệu thì giữ lấy lai giá tri cũ trc khi xóa
                if ($("#txtChoice" + i).val() != "" || $("#txtDescription" + i).val() != "") {

                    //  var promotion = $("#Promotion" + i).val();
                    var materialCode = $("#txtChoice" + i).val();
                    var materialName = $("#spName" + i).text();
                    var amount = $("#txtDescription" + i).val();
                    //  var PcsOnCTN = $("#spQuyDoi" + i).html();
                    var sAmount = $("#spGrossAmount" + i).text();
                    var hidGrossAmount = $("#hidAmount" + i).val();


                    // xóa dòng cũ
                    $("#pRow" + i).remove();

                    $("#tableChoices").append("<tr id='pRow" + ctrlId + "'><td width='20px' class='tdLabel'>" + (ctrlId) + ".</td><td width='130px'><input class='TextBoxInPut' type='text' name='txtChoice" + ctrlId + "' id='txtChoice" + ctrlId + "' style = 'width: 130px' onblur='SetOnBlurMaterial(" + ctrlId + ")' value='" + materialCode + "' /></td><td><span id = 'spName" + ctrlId + "'>" + materialName + "</span></td><td><textarea rows='3' cols='10' class='TextBoxInPut' type='text' name='txtDescription" + ctrlId + "' id='txtDescription" + ctrlId + "' value='" + materialCode + "' /></td><td nowrap ='nowrap' align = 'center'>&nbsp;&nbsp;<a id = 'hplSel" + ctrlId + "'  href = 'javascript:SelectCentifiedHouseholdNganhNghe(" + ctrlId + ")'>Chọn</a>&nbsp;-&nbsp;<a href='#' onClick='removeFormField(\"#pRow" + ctrlId + "\"); return false;'>Xóa</a><input type='text' name='hidAmount" + ctrlId + "' id='hidAmount" + ctrlId + "' value = '0' style = 'width: 1px; display: none' /></td></tr>");


                    SetTypeforNumber(ctrlId);
                }
                else {
                    $("#pRow" + i).remove();

                    $("#tableChoices").append("<tr id='pRow" + ctrlId + "'><td width='20px' class='tdLabel'>" + (ctrlId) + ".</td><td ><input  class='TextBoxInPut' type='text' name='txtChoice" + ctrlId + "' id='txtChoice" + ctrlId + "' style = 'width: 130px' onblur='SetOnBlurMaterial(" + ctrlId + ")' /></td><td><span id = 'spName" + ctrlId + "'></span></td><td ><textarea rows='3' clos='10'  class='TextBoxInPut' type='text' name='txtDescription" + ctrlId + "' id='txtDescription" + ctrlId + "' /></td><td nowrap ='nowrap' align = 'center'>&nbsp;&nbsp;<a id = 'hplSel" + ctrlId + "'  href = 'javascript:SelectCentifiedHouseholdNganhNghe(" + ctrlId + ")'>Chọn</a>&nbsp;-&nbsp;<a href='#' onClick='removeFormField(\"#pRow" + ctrlId + "\"); return false;'>Xóa</a><input type='text' name='hidAmount" + ctrlId + "' id='hidAmount" + ctrlId + "' value = '0' style = 'width: 1px; display: none' /></td></tr>");


                    // CreateOption(ctrlId);

                    SetTypeforNumber(ctrlId);
                }
            }
            SetAutoComplete();
        }

        //ga'n lai index khi remove
        index.val(index.val() - 1);

        showRowIndexs();
        //GetTotalGrossAmount();
    }

    function CheckValuePress(id) {
        alert($("#txtAmount" + sIndex).val());


        if ($("#txtAmount" + sIndex).val() = 0) {
            Alertbox("Hãy nhập số lượng");

        }

    }

    function SetAutoComplete() {
        $(".TextBoxInPut").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/GetListAutoCompleteNganhNghe")%>',
                    data: "{ 'strSrc': '" + request.term.trim() + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) {
                        return data;
                    },
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            $("#<%=txtmaterialCode.ClientId %>").val('');
                            return {
                                value: item
                            }
                        }))
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        //Alertbox(textStatus);
                    }
                });
            },
            minLength: 1
        });

        $('input').live("keypress", function (e) {
            /* ENTER PRESSED*/
            if (e.keyCode == 13) {
                /* FOCUS ELEMENT */
                var inputs = $(this).parents("form").eq(0).find(":input");
                var idx = inputs.index(this);

                //hard code for edit
                if ((idx - 25) % 3 == 1) {
                    inputs[idx + 2].focus();
                    inputs[idx + 2].select();
                } else {

                    inputs[idx + 1].focus(); //  handles submit buttons
                    inputs[idx + 1].select();
                }
                return false;
            }
        });

    }
    //Set lai gia tri khi nguoi dung chon san pham bang chuc nang AutoComplete
    function SetOnBlurMaterial(sIndexName) {
        var sMaterialName = $("#txtChoice" + sIndexName).val();
        if (sMaterialName != "") {
            if (sMaterialName.indexOf(" - ") != -1) {
                var arrMaterial = sMaterialName.split(" - ");
                $("#spName" + sIndexName).html(arrMaterial[1]);
                $("#txtChoice" + sIndexName).val(arrMaterial[0]);
            }
            else
                $("#txtChoice" + sIndexName).val(sMaterialName.substring(0, 6));

            //                $("#txtAmount" + sIndexName).select();
            //  GetAmountItem(sMaterialName.substring(0, 6), $("#txtAmount" + sIndexName).val(), $("#ddlUnit" + sIndexName).val(), sIndexName);
        }

    }

    function SelectCentifiedHouseholdNganhNghe(item) {
        $("#<%=hplShowCertifiedHouseholdNganhNghe.ClientId %>").attr("href", "../../FrontEnd/Page/Member/Popup.aspx?item=" + item + "&keepThis=true&TB_iframe=true&height=420&width=500&modal=true");
        $("#<%=hplShowCertifiedHouseholdNganhNghe.ClientId %>").click();
    }

    function setProductValue(MaterialCode, MaterialName, item) {
        $("#txtChoice" + item).val(MaterialCode);
        $("#spName" + item).html(MaterialName);
        // GetAmountItem(MaterialCode, $("#txtAmount" + item).val(), $("#ddlUnit" + item).val(), item);
    }


    //show chi tiết ngành nghề
    function RowDetailOrder(ctrlId, objDetail) {
        var str = "<tr id='pRow" + ctrlId + "'>\
        <td width='20px' class='tdLabel'>" + (ctrlId + 1) + ".</td>\
        <td width='130px'>\
        <input class='TextBoxInPut' type='text' name='txtChoice" + ctrlId + "' id='txtChoice" + ctrlId + "' style = 'width: 130px' onblur='SetOnBlurMaterial(" + ctrlId + ")' value='" + objDetail.Code + "' />\
        </td><td>\
        <span id = 'spName" + ctrlId + "'>" + objDetail.Name + "</span>\
        </td><td>\
        <textarea rows='3' cols='10' class='TextBox' type='text' name='txtDescription" + ctrlId + "' id='txtDescription" + ctrlId + "' value='" + objDetail.Description + "'/>\
        </tr>";
        return str;
    }

    function getProvince(ProvinceId, ddlEffect) {

        $.ajax({
            url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/getProvince")%>',
            data: "{'ProvinceId': '" + ProvinceId + "'}",
            dataType: "json",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                json = eval("(" + data.d + ")");
                $(function () {
                    ddlEffect.find('option').remove().end().append('<option value="">--- Chọn --- </option>');
                    for (i = 0; i < json.length; i++) {
                        var _Text = json[i]["Title"];
                        var _Value = json[i]["Id"];
                        ddlEffect.append('<option value=' + _Value + '>' + _Text + '</option>');
                    }
                    return false;
                });

            }, //ham thuc thi neu thanh cong    
            error: function () {
                alert("Có lỗi xảy ra. Vui lòng kiểm tra đường truyền");
            } //ham thuc thi neu loi xay ra.
        });
        return false;

    }


</script>
<asp:UpdatePanel ID="updateEditBussiness" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3 class="text-center">
                    GIẤY ĐỀ NGHỊ ĐĂNG KÝ HỘ KINH DOANH
                </h3>
            </div>
            <div class="box_contentform">
                <div class="box_scroll_grid">
                    <div class="DivRequired">
                        <span class="fieldRequired">&nbsp;</span>Các trường <span style="color: red">*</span>
                        yêu cầu bắt buộc nhâp
                    </div>
                    <div class="Error-Center">
                        <div id="divError">
                            <ul id="lstErrorContent">
                            </ul>
                        </div>
                    </div>
                    <%--thong tin chung--%>
                    <div class="panel-group">
                        <div class="panel-heading">
                            <%--start .panel-heading thong tin ho kinh doanh --%>
                            <img src='<%=ResolveUrl("~/images/arrow-down.png")%>' border="0" align="absmiddle" alt="">
                            Thông tin hộ kinh doanh
                        </div>
                        <div class="panel-body">
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label21" CssClass="TextLabel" runat="server" Text="Họ tên đại diên kinh doanh: " />
                                </div>
                                <div class="DivTextBox">
                                    <cc1:ValidationTextBox ID="txtOwRepresentative" CssClass="TextBox" Group="reg" AssociatedLableText="Họ tên đại diên kinh doanh."
                                        runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                            style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label24" CssClass="TextLabel" runat="server" Text="Giới tính: " />
                                </div>
                                <div class="DivTextBox text_inputright">
                                    <asp:RadioButtonList ID="rdlSex" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Value="1" Text="Nam" Selected="True" />
                                        <asp:ListItem Value="0" Text="Nữ" />
                                    </asp:RadioButtonList>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label26" CssClass="TextLabel" runat="server" Text="Ngày sinh: " />
                                </div>
                                <div class="DivTextBox">
                                    <cc1:ValidationTextBox ID="txtOwDateOfBirth" CssClass="TextBox Date" Group="reg"
                                        AssociatedLableText="Ngày sinh." runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                            style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label27" CssClass="TextLabel" runat="server" Text="Dân tộc: " />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlCitizen" Group="reg" AssociatedLableText="Dân tộc"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label28" CssClass="TextLabel" runat="server" Text="Quốc tịch: " />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlCountry" Group="reg" AssociatedLableText="Quốc tịch"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="link_expand">
                                <a href="" class="cmnd active" id="cmndRegion">CMND</a>&nbsp;|&nbsp;<a href="" class="gtk"
                                    id="gtkRegion">Giấy tờ khác</a>
                            </div>
                            <div id="cmnd">
                                <div class="DivRow">
                                    <div class="DivLabel">
                                        <asp:Label ID="Label22" CssClass="TextLabel" runat="server" Text="Số CMND: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc1:ValidationTextBox ID="txtOwCardId" CssClass="TextBox " Group="reg" AssociatedLableText="Số CMND."
                                            runat="server" Text="" MaxLength="50"></cc1:ValidationTextBox>&nbsp;<span style="color: red">*</span>
                                    </div>
                                    <div class="DivLabel">
                                        <asp:Label ID="Label23" CssClass="TextLabel" runat="server" Text="Ngày cấp: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc1:ValidationTextBox ID="txtOwCardDate" CssClass="TextBox Date" Group="reg" AssociatedLableText="Ngày cấp."
                                            runat="server" Text="" MaxLength="50"></cc1:ValidationTextBox>&nbsp;<span style="color: red">*</span>
                                    </div>
                                </div>
                                <div class="DivRow">
                                    <div class="DivLabel">
                                        <asp:Label ID="Label25" CssClass="TextLabel" runat="server" Text="Nơi cấp: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc2:ValidationDropdownlist ID="ddlDeptCertified" Group="reg" AssociatedLableText="Nơi cấp"
                                            CssClass="DropDownList" runat="server">
                                        </cc2:ValidationDropdownlist>
                                        &nbsp;<span style="color: red">*</span>
                                    </div>
                                </div>
                            </div>
                            <div id="gtk" style="display: none;">
                                <div class="DivRow">
                                    <div class="DivLabel">
                                        <asp:Label ID="Label1" Text="Giấy tờ CTCN(không có CMND): " CssClass="TextLabel"
                                            runat="server" />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc2:ValidationDropdownlist ID="ddlOthersPaper" Group="reg" AssociatedLableText="Giấy tờ CTCN(không có CMND)"
                                            CssClass="DropDownList" runat="server">
                                        </cc2:ValidationDropdownlist>
                                        &nbsp;<span style="color: red">*</span>
                                    </div>
                                </div>
                                <div class="DivRow">
                                    <div class="DivLabel">
                                        <asp:Label ID="Label29" CssClass="TextLabel" runat="server" Text="Số CTCN: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc1:ValidationTextBox ID="txtOtherPaperCode" CssClass="TextBox " Group="reg" AssociatedLableText="Số CTCN."
                                            runat="server" Text="" MaxLength="50"></cc1:ValidationTextBox>&nbsp;<span style="color: red">*</span>
                                    </div>
                                    <div class="DivLabel">
                                        <asp:Label ID="Label30" CssClass="TextLabel" runat="server" Text="Ngày cấp: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc1:ValidationTextBox ID="txtOthersPaperDateIssue" CssClass="TextBox Date" Group="reg"
                                            AssociatedLableText="Ngày cấp." runat="server" Text="" MaxLength="50"></cc1:ValidationTextBox>&nbsp;<span
                                                style="color: red">*</span>
                                    </div>
                                </div>
                                <div class="DivRow">
                                    <div class="DivLabel">
                                        <asp:Label ID="Label31" CssClass="TextLabel" runat="server" Text="Nơi cấp: " />
                                    </div>
                                    <div class="DivTextBox">
                                        <cc2:ValidationDropdownlist ID="ddlOthersPaper_NoiCap" Group="reg" AssociatedLableText="Nơi cấp"
                                            CssClass="DropDownList" runat="server">
                                        </cc2:ValidationDropdownlist>
                                        &nbsp;<span style="color: red">*</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row_subtitle">
                                <div class="texttitle_sub">
                                    Hộ khẩu thường trú</div>
                                <div class="icon_arrow_sub">
                                    &nbsp;</div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblDC1" CssClass="TextLabel" Text="Địa chỉ:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc1:ValidationTextBox ID="txtDiaChiHoKhau" CssClass="TextBox" Group="reg" AssociatedLableText="Địa chỉ."
                                        runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                            style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label35" CssClass="TextLabel" Text="Tỉnh:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlTinhHoKhau" Group="reg" AssociatedLableText="Tỉnh"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label34" CssClass="TextLabel" Text="Huyện:" runat="server" />&nbsp;<span
                                        style="color: red">*</span>
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlHuyenHoKhau" Group="reg" AssociatedLableText="Huyện"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="Label33" CssClass="TextLabel" Text="Xã thị trấn:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlXaThiTranHoKhau" Group="reg" AssociatedLableText="Xã thị trấn"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="row_subtitle">
                                <div class="texttitle_sub">
                                    Chỗ ở hiện tai</div>
                                <div class="icon_arrow_sub">
                                    &nbsp;</div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblDC2" CssClass="TextLabel" Text="Địa chỉ:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc1:ValidationTextBox ID="txtDiaChiHienTai" CssClass="TextBox" Group="reg" AssociatedLableText="Địa chỉ."
                                        runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                            style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblTinh2" CssClass="TextLabel" Text="Tỉnh:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlTinhHienTai" Group="reg" AssociatedLableText="Tỉnh"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblHuyen2" CssClass="TextLabel" Text="Huyện:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlHuyenHienTai" Group="reg" AssociatedLableText="Huyện"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                            <div class="DivRow">
                                <div class="DivLabel">
                                    <asp:Label ID="lblXaThiTran" CssClass="TextLabel" Text="Xã thị trấn:" runat="server" />
                                </div>
                                <div class="DivTextBox">
                                    <cc2:ValidationDropdownlist ID="ddlXaThiTranHienTai" Group="reg" AssociatedLableText="Xã thị trấn"
                                        CssClass="DropDownList" runat="server" DataType="required">
                                    </cc2:ValidationDropdownlist>
                                    &nbsp;<span style="color: red">*</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <%--thong tin chung--%>
                    <div class="panel-heading">
                        <%--start .panel-heading thong tin ho kinh doanh --%>
                        <img src='<%=ResolveUrl("~/images/arrow-down.png")%>' border="0" align="absmiddle" alt="">
                        Đăng ký hộ kinh doanh với các nội dung sau
                    </div>
                    <div class="panel-body">
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label10" CssClass="TextLabel" runat="server" Text="Tên hộ kinh doanh: " />
                            </div>
                            <div class="DivTextBox">
                                <cc1:ValidationTextBox ID="txtBizName" CssClass="TextBox" Group="reg" AssociatedLableText="Tên hộ kinh doanh."
                                    runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                        style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblDiaDiemKD" CssClass="TextLabel" runat="server" Text="Địa điểm kinh doanh: " />
                            </div>
                            <div class="DivTextBox">
                                <cc1:ValidationTextBox ID="txtBiz_HeadOffice" CssClass="TextBox" Group="reg" AssociatedLableText="Địa điểm kinh doanh."
                                    runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                        style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblTinhKD" CssClass="TextLabel" Text="Tỉnh:" runat="server" />
                            </div>
                            <div class="DivTextBox">
                                <cc2:ValidationDropdownlist ID="ddlTinhDiaDiemKD" Group="reg" AssociatedLableText="Tỉnh"
                                    CssClass="DropDownList" runat="server" DataType="required">
                                </cc2:ValidationDropdownlist>
                                &nbsp;<span style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblHuyenKD" CssClass="TextLabel" Text="Huyện:" runat="server" />
                            </div>
                            <div class="DivTextBox">
                                <cc2:ValidationDropdownlist ID="ddlHuyenDiaDiemKD" Group="reg" AssociatedLableText="Huyện"
                                    CssClass="DropDownList" runat="server" DataType="required">
                                </cc2:ValidationDropdownlist>
                                &nbsp;<span style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblXaThiTranKD" CssClass="TextLabel" Text="Xã thị trấn:" runat="server" />
                            </div>
                            <div class="DivTextBox">
                                <cc2:ValidationDropdownlist ID="ddlXaThiTranDiaDiemKD" Group="reg" AssociatedLableText="Xã thị trấn"
                                    CssClass="DropDownList" runat="server" DataType="required">
                                </cc2:ValidationDropdownlist>
                                &nbsp;<span style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label13" CssClass="TextLabel" runat="server" Text="Điện thoại: " />
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtOw_Tel" CssClass="TextBox" runat="server" Text="" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label14" CssClass="TextLabel" runat="server" Text="Fax: " />
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtOw_Fax" CssClass="TextBox" runat="server" Text="" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label15" CssClass="TextLabel" runat="server" Text="Email: " />
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtOw_Email" CssClass="TextBox" runat="server" Text="" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label16" CssClass="TextLabel" runat="server" Text="Website: " />
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtOw_WebSite" CssClass="TextBox" runat="server" Text="" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label18" CssClass="TextLabel" runat="server" Text="Lĩnh vực kinh doanh: " />
                            </div>
                            <div class="DivTextBox">
                                <cc2:ValidationDropdownlist ID="ddlBusinessField" Group="reg" AssociatedLableText="Lĩnh vực kinh doanh"
                                    CssClass="DropDownList" runat="server" DataType="required">
                                </cc2:ValidationDropdownlist>
                                &nbsp;<span style="color: red">*</span>
                            </div>
                        </div>
                        <!-- Phần thêm chi tiết -->
                        <div class="DivRow">
                            <div class="row_subtitle">
                                <div class="texttitle_sub">
                                    Ngành nghề kinh doanh</div>
                                <div class="icon_arrow_sub">
                                    &nbsp;</div>
                            </div>
                            <%--<span id="clxp" style="cursor: pointer">
                        <img id="imgshowhide" alt="" src="images/arrow_showless.gif" /></span>--%>
                            <div id="search" class="BoxField">
                                <div class="form" id="form">
                                    <div class="SubjectTitle">
                                        <div class="DivTextBox">
                                            <div runat="server" id="divChoices">
                                                <table id='tableChoices' class="table table-bordered GridBorder" style="border-width: 1px;
                                                    border-style: solid; width: 100%; border-collapse: collapse;" width="100%">
                                                    <tr id='pRow' class="GridHeader">
                                                        <td width='20px' class='tdLabelT'>
                                                            <b>STT</b>
                                                        </td>     
                                                        <td width='300px'>
                                                            <b>Tên ngành nghề</b>
                                                        </td>
                                                        <td width='300px'>
                                                            <b>Chi tiết ngành nghề</b>
                                                        </td>
                                                        <td width='60px'>
                                                            <b>Mã ngành nghề</b>
                                                        </td>
                                                   
                                                        
                                                        <td width='70px' nowrap="nowrap">
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <input type="button" onclick="addFormField();return false;" value="Thêm" class="btn btn-info" />
                                        </div>
                                    </div>
                                    <div class="DivRow">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label19" CssClass="TextLabel" runat="server" Text="Vốn kinh doanh: " />
                            </div>
                            <div class="DivTextBox">
                                <cc1:ValidationTextBox ID="txtBiz_InvestCapital" CssClass="TextBox" Group="reg" AssociatedLableText="Vốn kinh doanh."
                                    runat="server" Text="" MaxLength="50" DataType="required"></cc1:ValidationTextBox>&nbsp;<span
                                        style="color: red">*</span>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label20" CssClass="TextLabel" runat="server" Text="Tiền viết bằng chữ: " />
                            </div>
                            <div class="DivTextBox">
                                <asp:Label ID="txtBiz_WordsMoney" runat="server" Text="" />
                                <asp:TextBox ID="txtMoney_string" runat="server" Text="" Style="display: none;" />
                            </div>
                        </div>
                        <div class="row_subtitle">
                            <div class="texttitle_sub">
                                Thành phần hồ sơ</div>
                            <div class="icon_arrow_sub">
                                &nbsp;</div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                &nbsp;
                            </div>
                            <div class="DivTextBox">
                                <asp:GridView ID="grdShow" runat="server" AutoGenerateColumns="False" EmptyDataText="{Không có dữ liệu}"
                                    AllowPaging="false" Width='50%' BorderWidth="1px" CssClass="GridBorder">
                                    <Columns>
                                        <asp:TemplateField>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkItem" runat="server" />
                                            </ItemTemplate>
                                            <ItemStyle Width="15%" HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="STT">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblSTT" Text=''></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle Width="15%" HorizontalAlign="Left" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField='TenHoSo' HeaderText='Tên Hồ sơ'>
                                            <ItemStyle Width='70%' />
                                        </asp:BoundField>
                                    </Columns>
                                    <HeaderStyle Height="26px" HorizontalAlign="Left" CssClass="GridHeader" />
                                    <RowStyle CssClass="GridRow" Height="23px" />
                                    <AlternatingRowStyle CssClass="GridAlterRow" />
                                    <PagerStyle CssClass="GridPaged" HorizontalAlign="Right" Height="23px" />
                                    <PagerSettings Mode="Numeric" PageButtonCount="2" />
                                    <EmptyDataRowStyle CssClass="GridTextEmpty" HorizontalAlign="Center" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;&nbsp;&nbsp;</div>
                        <div class="DivTextBox">
                            <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn btn-info" CausesValidation="false" />
                            <asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy " CssClass="btn btn-info" />
                        </div>
                    </div>
                    <div style="display: none">
                        <asp:HiddenField ID="hidID" Value="0" runat="server" />
                        <asp:HiddenField ID="HidUserName" Value="0" runat="server" />
                    </div>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
<div style="display: none">
    <asp:HiddenField runat="server" ID="hidRowIndex" Value="0" />
    <!-- by default there will be two inputs available to insert choices -->
    <asp:HyperLink ID="hplShowCertifiedHouseholdNganhNghe" runat="server" CssClass="thickbox"
        NavigateUrl="~/FrontEnd/Page/Member/Popup.aspx?keepThis=true&TB_iframe=true&height=420&width=500&modal=true"></asp:HyperLink>
</div>
<div style="display: none">
    <input type="text" id="curId" />
    <input type="text" id="OriginalDeliveryDate" class="TextBox" />
    <asp:HiddenField ID="HiddenField2" Value="0" runat="server" />
    <asp:HiddenField ID="hidSafeOffice" Value="" runat="server" />
    <asp:TextBox ID="txtmaterialCode" Text="" runat="server" />
    <asp:HiddenField ID="hidSale_Unit" Value="2" runat="server" />
    <asp:TextBox ID="txtCustomer" runat="server" Text=""></asp:TextBox>
    <asp:TextBox ID="txtGrossAmount" runat="server" Text="0"></asp:TextBox>
    <asp:TextBox ID="txtMaterialDescription" runat="server" Text="" />
    <asp:TextBox ID="hidHuyenHienTai" runat="server" Text="" />
    <asp:TextBox ID="hidXaThiTranHienTai" runat="server" Text="" />
    <asp:TextBox ID="hidHuyenHoKhau" runat="server" Text="" />
    <asp:TextBox ID="hidXaThiTranHoKhau" runat="server" Text="" />
    <asp:TextBox ID="hidHuyenDiaDiemKD" runat="server" Text="" />
    <asp:TextBox ID="hidXaThiTranDiaDiemKD" runat="server" Text="" />
</div>
